package radio.vnmedia.vn.utils;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;

public class AlertManager {
	private Context mContext;

	public AlertManager(Context context) {
		this.mContext = context;
	}

	public void showYesNoDialog(int msg_id, final YesNoButtonAction action) {
		new AlertDialog.Builder(mContext).setMessage(msg_id).setCancelable(false).setPositiveButton("Yes", new OnClickListener() {

			
			public void onClick(DialogInterface dialog, int which) {
				if (action != null)
					action.onYesClick();
				dialog.dismiss();
			}
		}).setNegativeButton("No", new OnClickListener() {

			
			public void onClick(DialogInterface dialog, int paramInt) {
				if (action != null)
					action.onNoClick();
				dialog.dismiss();
			}
		}).setCustomTitle(null).show();
	}

	public void showOkDialog(int msg_content, final OkButtonAction action) {
		new AlertDialog.Builder(mContext).setMessage(msg_content).setTitle(null).setCancelable(false).setPositiveButton("Ok", new OnClickListener() {

			
			public void onClick(DialogInterface dialog, int which) {
				if (action != null)
					action.onOkClick();
				dialog.dismiss();
			}
		}).show();
	}

	public interface YesNoButtonAction {
		public void onNoClick();

		public void onYesClick();
	}

	public interface OkButtonAction {
		public void onOkClick();
	}
}
